If an error condition occurs, this routine returns an integer
value indicating the type of error. Possible return values are as
follows:
Return Description
0 Successful completion, the read-write lock object was
acquired for write access.
[EBUSY] The read-write lock could not be acquired for write
access because it was already locked for write access
or for read access.
[EDEADLCK] The current thread already owns the read-write lock
for write or read access.
[EINVAL] The value specified by rwlock does not refer to an
initialized read-write lock object.